<template>
    <div v-if="currentNode" class="ele-design-prop-eles ele-design-ele-tools" :class="[ { 'disabled': isLeafNode(currentNode.def) }]">
        <ul>
            <li :key="ele.component" v-for="ele in tplCate.viewElems"
                @click="handleAddChild(ele.component)"
                v-tippy="{ arrow: true, placement: 'bottom' }" :content="ele.name">
                <i :class="ele.icon"></i>
            </li>
            <span class="ele-design-ele-sep"></span>
            <li :key="ele.component" v-for="ele in tplCate.actionELems"
                @click="handleAddChild(ele.component)"
                v-tippy="{ arrow: true, placement: 'bottom' }" :content="ele.name">
                <i :class="ele.icon"></i>
            </li>

            <span class="ele-design-ele-sep"></span>
            <!---->

            <li :key="ele.component" v-for="ele in tplCate.dataElems"
                @click="handleAddChild(ele.component)"
                v-tippy="{ arrow: true, placement: 'bottom' }" :content="ele.name">
                <i :class="ele.icon"></i>
            </li>
            <span class="ele-design-ele-sep"></span>
            <li :key="ele.component" v-for="ele in tplCate.chartElems"
                @click="handleAddChild(ele.component)"
                v-tippy="{ arrow: true, placement: 'bottom' }" :content="ele.name">
                <i :class="ele.icon"></i>
            </li>
            <span class="ele-design-ele-sep"></span>
            <el-popover placement="bottom-start" trigger="hover" popper-class="popover-dropdown-menu el-dropdown-menu--small">
                <li slot="reference" class="more-ele-btn">表单 <i class="fa fa-caret-down"></i></li>
                <div class="ele-design-prop-eles ele-design-ele-dropdown small">
                    <ul>
                        <li :key="ele.component" v-for="ele in tplCate.formElems"
                            @click="handleAddChild(ele.component)"
                            v-tippy="{ arrow: true, placement: 'right' }" :content="ele.name">
                            <i :class="ele.icon"></i>
                            <p v-text="ele.name"></p>
                        </li>
                    </ul>
                </div>
            </el-popover>

            <!--<li :key="ele.component" v-for="ele in tplCate.formElems"
                @click="handleAddChild(ele.component)"
                v-tippy="{ arrow: true, placement: 'right' }" :content="ele.name">
                <i class="fa" :class="ele.icon"></i>
            </li>-->
        </ul>
    </div>
</template>

<script>
    import BuilderNodesAdd    from './builder-nodes-add';

    export default {
        name: "builder-nodes-add-tools",
        extends: BuilderNodesAdd,
        props: {},
        data() {
            return {}
        },
        computed: {},
        components: {},
        watch: {},
        mounted() {},
        methods: {}
    }
</script>
<style lang="scss" scoped>
.ele-design-ele-tools {
    position: fixed;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    flex-flow: row;
    height: auto;
    overflow: hidden;
    border-radius: 2px;

    &.disabled {
        opacity: .6;

        ul li {
            color: #CCC;

            &:hover {
                color: #CCC;
            }
        }

        &:before {
            display: none;
        }
    }

    ul li {
        width: 30px;
        height: 30px;
        padding: 5px;
        margin: 0px;
        border: none;
        text-align: center;
        justify-content: center;
        color: #409eff;
        background: transparent;
        border-radius: 0px;

        &:hover {
            background: #ecf5ff;
            color: #308EEF;
        }

        i {
            margin: 0px;
            font-size: 13px;
        }

        &.more-ele-btn {
            width: auto;
        }
    }

    .ele-design-ele-sep {
        width: 1px;
        background: #CCC;
        margin: 8px 2px;
        height: 14px;
        opacity: 0.8;
        transform: scale(.8);
    }
}
    .ele-design-ele-dropdown {
        width: 140px;

        ul li {
            width: 70px;
            margin: 0px;
            border-radius: 0px;

            &:hover {
                background: #ecf5ff;
                color: #308EEF;
            }

            i {
                font-size: 13px;
            }
        }
    }
</style>
